<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>登录</title>
		<meta name="Description" content="" />
		<meta name="Keywords" content="" />
		<meta name="format-detection" content="telephone=no, email=no" />
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
		<meta name="applicable-device" content="mobile" />
		<meta name="apple-mobile-web-app-title" content="" />
		<!-- 添加到主屏后的标题（iOS 6 新增） -->
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<!-- 是否启用 WebApp 全屏模式 -->
		<meta name="HandheldFriendly" content="true" />
		<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
		<meta name="author" content="Jack" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<script src="../../js/flexible.js" type="text/javascript" charset="utf-8"></script>		
		<link rel="stylesheet" type="text/css" href="../../style/jquery_css/weui.css"/>
		<link rel="stylesheet" type="text/css" href="../../style/jquery_css/jquery-weui.css"/>
		<link rel="stylesheet" type="text/css" href="../../style/main.css" />
		<link rel="stylesheet" type="text/css" href="../../style/icon.css"/>			
	</head>
	<body>
		<div class="main-box">
			<div class="header-nav">
				<div class="cen-mony color-guess">
					<div class="header-flex">
						<i class="return-2" onclick="window.location.href='../my/my.html'"></i>
					</div>
					<div class="header-flex"></div>
					<div class="header-flex"></div>
				</div>
			</div>
			<div class="login-cen">
				<div class="logo-box"><img src="../../images/logo.png" class="logo" style="border-radius:0"/></div>
				<!--<div class="login-main-font" style="margin-top: 0;text-align: center;">欢迎使用安生车管家</div>-->
				<div>
					<div>
						<input type="number" class="login-phone-input" placeholder="请输手机号" id="phone-num"/>
					</div>
					<div class="top-pwd">
						<input type="password" class="login-phone-input pwd-input" placeholder="请输入密码" id="pwd"/>
						<i class="icon-eye-1"  onclick="is_look_pwd(this)"></i>
					</div>
					<div class="login-btn-top">
						<button class="UDC-btn UDC-btn-bg" onclick="login_fn()">登录</button>
					</div>
					<div class="top-forget">
						<div class="inile-block pas">
							还没有账号？<a href="register.html" class="is-a">注册</a>
						</div>
						<div class="inile-block forget-pwd">
							<a href="forget_pwd.html" class="is-a">忘记密码？</a>
						</div>
					</div>
				</div>
			</div>
			
		</div>
		<!--注册方式-->
		
		<!--<div class="register-diao"></div>
		<div class="register-box">
				<div class="login-cen">
					<div class="pattern">选择注册方式</div>
					<div class="res-bottom">
						<a href="register.html" class="UDC-btn resg-btn-bg">邮箱注册</a>
					</div>
					<div class="res-bottom">
						<a href="javascript:;" class="UDC-btn common-bg">普通注册</a>
					</div>
				</div>
			</div>-->
	</body>
	<script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/weiUI/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/api/api_url.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/api/port_url.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		
		function login_fn(){
			var reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
			if($.trim($('#phone-num').val()) == ''){
        		$.toast("请输入手机号!", "text");
                return false;
            }
			/*if(!reg.test($.trim($('#phone-num').val()))) {
				$.toast("请输入正确的手机号码!", "text");
                return false;
            }*/			
			if($.trim($('#pwd').val()) == ''){
            	$.toast("请填写密码!", "text");
                return false;
            }
            if($.trim($('#pwd').val()).length<6){
            	$.toast("密码不能小于6位数!", "text");
                return false;
            }
            
            $.showLoading(' ');
            $.ajax({
				url: config_URL.api+URL.login, //请求的url地址
				dataType: "json", //返回格式为json
				data:{
					access_token:'41ab23e7efb238797fe39cc30f6b21d3',
					username:$('#phone-num').val(),
					password:$('#pwd').val()
				},
				type: "POST", //请求方式
				success: function(res) {
					console.log(res)
					if(res.code==0){
          				$.hideLoading();
						$.toast("登录成功",'text');
						setTimeout(function() {
							window.location.href = '../my/my.html'
						}, 2000)
						var str = JSON.stringify(res.data);
						sessionStorage.setItem('users_info',[str]);	
						
					}else{
						$.toast(res.msg, "text");
					}
					
					
				},
				error: function(rul) {
					console.log('网络出错')
				}
			});
            
            
		}
		
			
//		function register_diao(){
//			$('.register-diao').fadeIn();
//			$('.register-box').animate({
//				bottom:0
//			})
//			
//		}
		$('.register-diao').click(function(){
				$('.register-box').animate({
					bottom:-245
				});
				$('.register-diao').fadeOut();
			})
		
		function is_look_pwd(_this){
			var demoInput = $(_this).prev();
		  if (demoInput.attr('type')=="password") {
			   	demoInput.attr('type','text');
			   	$(_this).removeClass('icon-eye-1').addClass('icon-eye-color');   
		  } else {
		   	demoInput.attr('type','password');
		   	$(_this).removeClass('icon-eye-color').addClass('icon-eye-1');
		  }
		}
		
	</script>
</html>
